DESCRIPTION = "fpga ctrl led"

SRC_URI = "file://fpga_ctrl.c"
SRC_URI += "file://service_files/fpga_ctrl.service"
PV = "1.0"
S = "${WORKDIR}"

LICENSE = "CLOSED"

inherit systemd
SYSTEMD_SERVICE:${PN} += "fpga_ctrl.service"
SYSTEMD_AUTO_ENABLE:${PN} = "enable"

DEPENDS += " \
    dbus \
    systemd \
    "

do_compile() {
    ${CC} ${LDFLAGS} fpga_ctrl.c -o fpga_ctrl -lsystemd
}

do_install () {
    install -m 0755 -d ${D}${bindir} ${D}${datadir}/fpga_ctrl
    install -m 0755 ${S}/fpga_ctrl ${D}${bindir}

    install -m 0755 -d ${D}${base_libdir}/systemd/system/ 
    install -m 0644 ${WORKDIR}/service_files/fpga_ctrl.service ${D}${base_libdir}/systemd/system/
}

do_print() {
    echo "testlog: ${S}"
    echo "testlog: ${D}"
    echo "testlog: ${sysconfdir}"
    echo "testlog: ${datadir}"
    echo "testlog: ${WORKDIR}"
}


FILES:${PN} += "${bindir}/fpga_ctrl"
FILES:${PN} += "${datadir}"
FILES:${PN} += "${base_libdir}/systemd/system/fpga_ctrl.service"
